package com.kernel.streamDemo;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/****************************************
 * @name WriterDemo01
 * @description 字符输出流学习
 * @author 黄彬恒
 * @since 2018/8/17
 ***************************************/
public class WriterDemo01 {
    public static void main(String[] args) {
        File file = new File("D:\\ideaProgram\\IOLearning\\src\\main\\resources\\4.txt");
        Writer fw = null;
        try {
            fw = new FileWriter(file, true);
            String string = "\r\nhello world";
            fw.write(string);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fw != null) {
                try {
                    fw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
